<template>
    <div class="common-table">
        <el-table :data="tableData" style="height: 90%" stripe  v-loading="config.loading">
            <el-table-column
                    prop="id"
                    label="编号"
                    width="200">
            </el-table-column>
            <el-table-column
                    prop="pcata"
                    label="分类"
                    width="200">
            </el-table-column>
            <el-table-column
                    prop="pname"
                    label="商品名"
                    width="200">
            </el-table-column>
            <el-table-column
                    prop="pprice"
                    label="价格"
                    width="200">
            </el-table-column>
            <el-table-column
                    prop="pdes"
                    label="评论"
                    width="200">
            </el-table-column>

            操作列
            <el-table-column label="操作" >
                <template slot-scope="scope">
                    <el-button
                            size="mini"
                            @click="handleEdit(scope.row)">编辑</el-button>
                    <el-button
                            size="mini"
                            type="danger"
                            @click="handleDelete(scope.row)">删除</el-button>
                </template>
            </el-table-column>

        </el-table>
        <!--分页栏-->
        <el-pagination
                class="pager"
                layout="prev, pager, next"
                :total="config.total"
                :current-page.sync="config.page"
                @current-change="changePage">
        </el-pagination>
    </div>
</template>

<script>
    export default {
        name: "CommonTableMarket",
        props:{
            tableData:Array,
            tableLabel:   Array,
            config:Object
        },
        methods:{
            handleEdit(row){
                this.$emit('edit',row)
            },
            handleDelete(row){
                this.$emit('del',row)
            },
            changePage(page){
                this.$emit('changPage',page)
            }
        }
    }
</script>

<style scoped>
    .common-table{
        height: calc(100% - 62px);
        background-color: #fff;
        position:relative;

    }
    .pager{
        position: absolute;
        bottom: 20px;
        right: 20px;
    }
</style>